package com.common;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @ClassName : GlobalExceptionHandler
 * @Auther : acerolan@foxmail.com
 * @Data : 2024/7/24 14:16
 * @Description :
 */
//@RestControllerAdvice
public class GlobalExceptionHandler {

    /**
     * 捕获 Exception 捕获Exception异常
     */
    @ExceptionHandler(Exception.class)
    public String runtimeExceptionHandler(HttpServletRequest request,
                                          final Exception e, HttpServletResponse response) {
        System.out.println("##### 全局异常方法执行了 #####");
        return "出错误了....";
    }
}
